package com.big.pay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.big.model.model.pay.PayLog;
import com.big.pay.mapper.PayLogMapper;
import com.big.pay.service.PayLogService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class PayLogServiceImpl extends ServiceImpl<PayLogMapper, PayLog> implements PayLogService {


    /**
     * 添加支付记录
     * @param payLog
     * @return
     */
    @Override
    public Integer savePayLog(PayLog payLog) {
        Integer insert = baseMapper.insert(payLog);
        return insert;
    }

    /**
     * 查询交易记录
     */
    @Override
    public PayLog payLogInfo(Long d_id) {
        QueryWrapper<PayLog> wrapper= new QueryWrapper<>();
        if(!StringUtils.isEmpty(d_id)){
            wrapper.eq("d_id",d_id);
        }
        PayLog payLog = baseMapper.selectOne(wrapper);
        return payLog;
    }
}
